
#include "consts.h"
#include "param.h"
#include "proc.h"
#include "proc_wrappers.h"

#include <GL/gl.h>
#include <GL/glut.h>

#include <iostream>

param Gparams
(
    WIN_WIDTH, WIN_HEIGHT,
    WIN_X_POS, WIN_Y_POS,
    WIN_NAME,
    FOVY, ZNEAR, ZFAR,
    DISPLAY_FONT
);

// the proc object implements functions that are wrapped and passed to glut
proc Gprocs(&Gparams);



int main(int argc, char** argv)
{
    glutInit(&argc, argv);
                                        
    glutInitDisplayMode (GLUT_DOUBLE | GLUT_RGB | GLUT_DEPTH);
    glutInitWindowSize (Gparams.win_width, Gparams.win_height);
    glutInitWindowPosition (Gparams.win_x_pos, Gparams.win_y_pos);
    glutCreateWindow (Gparams.win_name.c_str());
    //todo: glutIdleFunc(idle_proc_wrapper);
    glutVisibilityFunc(visibility_proc_wrapper);
    glutDisplayFunc(display_proc_wrapper);
    //std::cout << glutLayerGet(GLUT_OVERLAY_POSSIBLE);
    glutReshapeFunc(reshape_proc_wrapper);
    glutKeyboardFunc(keyboard_proc_wrapper);
    glutSpecialFunc(keyboard_special_proc_wrapper);
    glutMouseFunc(mouse_proc_wrapper);
    glutMotionFunc(motion_proc_wrapper);
    glutPassiveMotionFunc(passive_motion_proc_wrapper);

    glEnable(GL_DEPTH_TEST);
    
    glutMainLoop();

    return 0; // the execution will never reach this place
                // (but the code still makes the compiler happy)
}
